namespace Profit.Converters
{
    using System;
    using System.Globalization;
    using System.Windows.Data;
    using Core.Contracts.Enums;

    [ValueConversion(typeof(AmmunitionTypesEnum), typeof(string))]
    public class AmmunitionTypeToImageSourceConverter : IValueConverter
    {
        /// <summary>
        /// Converts a value. 
        /// </summary>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        /// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            switch ((AmmunitionTypesEnum)value)
            {
                case AmmunitionTypesEnum.SmallSlugs :
                case AmmunitionTypesEnum.MediumSlugs:
                    return "pack://application:,,/Resources/Icons/SmallMagnedartSlug.png";

                case AmmunitionTypesEnum.SmallEnergyCells:
                case AmmunitionTypesEnum.MediumEnergyCells:
                    return "pack://application:,,/Resources/Icons/SmallPhotokineticEnergyCell.png";

                case AmmunitionTypesEnum.SmallBullets:
                case AmmunitionTypesEnum.MediumBullets:
                    return "pack://application:,,/Resources/Icons/SmallArmorPiercingBullet.png";

                case AmmunitionTypesEnum.SmallMissiles:
                    return "pack://application:,,/Resources/Icons/SmallArmorPiercingBallisticMissile.png";

                case AmmunitionTypesEnum.MediumMissiles:
                    return "pack://application:,,/Resources/Icons/MediumArmorPiercingBallisticMissile.png";

                case AmmunitionTypesEnum.EnergyInjectorCharges:
                    return "pack://application:,,/Resources/Icons/StandardEnergyInjectorCharge.png";

                case AmmunitionTypesEnum.HarvesterCharges :
                    return "pack://application:,,/Resources/Icons/UniversalHarvesterCharge.png";

                case AmmunitionTypesEnum.MinerCharges:
                    return "pack://application:,,/Resources/Icons/MinerChargeLiquizit.png";

                case AmmunitionTypesEnum.GeoscannerCharges:
                    return "pack://application:,,/Resources/Icons/AreaBasedGeoscannerChargeLiquizit.png";

                case AmmunitionTypesEnum.InterferenceEmitterCharges :
                    return "pack://application:,,/Resources/Icons/LowFrequencyEmitter.png";
                case AmmunitionTypesEnum.TerraformingCharges:
                    return "pack://application:,,/Resources/Icons/TerraformingCharge.png";
                
            }
            return null;
        }

        /// <summary>
        /// Converts a value. 
        /// </summary>
        /// <returns>
        /// A converted value. If the method returns null, the valid null value is used.
        /// </returns>
        /// <param name="value">The value that is produced by the binding target.</param><param name="targetType">The type to convert to.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}